package Week3.num.week3Test1.opp02;

public class SalariedEmployee extends ColaEmployee {
    private double monthlySal;

    /**
     * 空参构造
     */
    public SalariedEmployee() {
    }

    /**
     * 全参构造
     */
    public SalariedEmployee(String name, int month, double monthlySal) {
        super(name, month);
        this.monthlySal = monthlySal;
    }

    /**
     * get和set方法
     */
    public double getMonthlySal() {
        return monthlySal;
    }

    public void setMonthlySal(double monthlySal) {
        this.monthlySal = monthlySal;
    }


    /**
     * 重写获取工资的方法
     * @param month 发放工资月份
     * @return 当月工资
     */
    @Override
    public double getSalary(int month){
        if (month==this.getMonth()){
            return (this.getMonthlySal()+100);
        }
        return this.getMonthlySal();
    }
}
